package com.idanchuang.component.mybatis.plus.plugins;

import com.baomidou.mybatisplus.core.parser.SqlInfo;
import com.idanchuang.component.core.helper.EnvContext;
import org.apache.ibatis.reflection.MetaObject;

/**
 * Shadow SQL RWrite Parser for Mybatis-plus
 *
 * @author Raistlin
 */
public class ShadowSQLRewriteParser implements AvailableSqlParser{

    @Override
    public SqlInfo parser(MetaObject metaObject, String sql) {
        if(EnvContext.isPressure()){
            return SqlInfo.newInstance().setSql("-- shadow\n" + sql);
        }
        return null;
    }

}
